package com.example.eurekacustomer.service;

import com.example.eurekacustomer.service.fallback.FeignServiceFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @Auther: zyb
 * @Date: 2018/11/7 11:22
 * @Description: 以Feign的方式调用服务
 */
//value：服务提供者应用名字,fallback：容错类
@FeignClient(value = "eureka-client", fallback = FeignServiceFallback.class)
public interface FeignService {

    @GetMapping("/index")
    String index();

    @GetMapping("/getUserName")
    String getUserName(@RequestParam("name") String name);

    @GetMapping("/getUserInfo")
    String getUserInfo(@RequestParam("name") String name, @RequestParam("password") String password);

    @PostMapping("/putUserName")
    String putUserName(@RequestParam("name") String name, @RequestParam("password") String password);
}
